package org.ljx.taobao.service;

import org.ljx.taobao.api.IShoppingService;
import org.ljx.taobao.api.entity.Shopping;
import org.ljx.taobao.dao.IShoppingDao;
import org.ljx.taobao.dao.impl.ShoppingDaoImpl;
import java.util.List;
/**
 * @Author: Ljx
 * @Date: 2021/12/31 11:31
 * @role: 购物车service层实现
 */
public class ShoppingServiceImpl implements IShoppingService {

    /**
     * 购买商品
     * @param shopping 订单实体
     * @return boolean
     */
    @Override
    public boolean commodity(Shopping shopping) {
        IShoppingDao iShoppingDao = new ShoppingDaoImpl();
        return iShoppingDao.commodity(shopping);
    }

    /**
     * 查询用户购买的商品
     * @return List<Shopping>
     */
    @Override
    public List<Shopping> query() {
        IShoppingDao iShoppingDao = new ShoppingDaoImpl();
        return iShoppingDao.query();
    }

    /**
     * 删除订单
     * @param shopping 订单实体
     * @return boolean
     */
    @Override
    public boolean delete(Shopping shopping) {
        IShoppingDao iShoppingDao = new ShoppingDaoImpl();
        return iShoppingDao.delete(shopping);
    }

    /**
     * 清除购物车
     * @param shopping 订单实体
     * @return boolean
     */
    @Override
    public boolean clear(Shopping shopping) {
        IShoppingDao iShoppingDao = new ShoppingDaoImpl();
        return iShoppingDao.clear(shopping);
    }

    /**
     * 订单数量 -1
     * @param shopping 订单实体
     * @return boolean
     */
    @Override
    public boolean decrease(Shopping shopping) {
        IShoppingDao iShoppingDao = new ShoppingDaoImpl();
        return iShoppingDao.decrease(shopping);
    }

    /**
     * 订单数量 +1
     * @param shopping 订单实体
     * @return boolean
     */
    @Override
    public boolean increase(Shopping shopping) {
        IShoppingDao iShoppingDao = new ShoppingDaoImpl();
        return iShoppingDao.increase(shopping);
    }

}

